﻿using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZHDJ.Data.Models.Common
{
    /// <summary>
    /// 历史上的今天
    /// </summary>
    public class PartyHistoryToday:EntityBase
    {
        #region 字段属性
        /// <summary>
        /// 标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 月
        /// </summary>
        public int? Month { get; set; }

        /// <summary>
        /// 日
        /// </summary>
        public int? Day { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        public string Content { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string CreateBy { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime? ModifyTime { get; set; }

        /// <summary>
        /// 修改人
        /// </summary>
        public string ModifyBy { get; set; }
        #endregion

        #region 查询管理
        public static DataTable GetPortalData(int month, int day)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("select Title,Content from tblpartyhistorytoday where Month=?Month and Day=?Day");

            MySqlParameter[] parameters = new MySqlParameter[]
            {
                new MySqlParameter("?Month",MySqlDbType.Int32),
                new MySqlParameter("?Day",MySqlDbType.Int32)
            };
            parameters[0].Value = month;
            parameters[1].Value = day;

            return MySqlHelper.ExecuteDataTable(sb.ToString(), parameters);
        }
        #endregion
    }
}
